
public class demo1 {
    public static void main(String[] args) {
        int ret=fac(3);
        System.out.println(ret);
    }
    public  static int fac(int n){          //求一个数的阶乘，输入3就求三的阶乘
        if(n==1){
            return 1;
        }
        return n*fac(n-1);

    }
    public  static int facsum(int n){    //把每个数的阶乘加起来
        int sum=0;
        for (int i = 0; i <n ; i++) {

            sum+=fac(i);

        }
        return  sum;

    }

}